
public class MyStack<E> {

  int capacity = 9;
  Object[] data = new Object[capacity];
  int top = -1;
  
  public void push(E o) {
    data[++top] = o;
  }

  public E pop() {
    if (top < 0)
      return null;
    return (E)data[top--];
  }
  
  public static void main(String[] args) {
    MyStack<Integer> stack = new MyStack<Integer>();
    Integer i = 3;
    stack.push(i);
    i = stack.pop();
  }
}
